package cn.quicklydoit.config;

/**
 * 用户角色
 */
public enum Group {
    USER(1,"USER"),ADMIN(-1,"ADMIN");
    private Integer code;
    private String name;
    private Group(Integer code,String name){
        this.code=code;
        this.name=name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static Group fromCode(Integer code){
        for(Group group:Group.values()){
            if(group.getCode().equals(code)){
                return group;
            }
        }
        return null;
    }
}
